#!/bin/bash

:<<EOF
= 判断两个字符串是否相等，相等返回true [ $a = $b ]
!= 判断两个字符串是否不相等，不相等返回为true [ $a != $b ]
-z 判断字符串长度是否为0，为0返回true [ -z $a ]
-n 判断字符串长度是否不为0，不为0返回true [ -n $a ]
$ 判断字符串是否不为空，不为空返回true [ $a ]
EOF

a="abc"
b="efg"
if [ $a = $b ]
then
	echo "a等于b"
else
	echo "a不等于b"
fi
if [ $a != $b ]
then
	echo "a不等于b"
else
	echo "a等于b"
fi
if [ -z $a ]
then
	echo "a的长度为0"
else
	echo "a的长度不为0"
fi
if [ -n $a ]
then 
	echo "a的长度不为0"
else
	echo "a的长度为0"
fi
if [ $a ]
then
	echo "a不为空"
else
	echo "a为空"
fi

